---
image: {{ .ModuleName }}/{{ .ImageName }}
fromImage: common/distroless
import:
- artifact: {{ .ModuleName }}/{{ .ImageName }}-artifact
  add: /src/exporter
  to: /exporter
  after: setup
docker:
  ENTRYPOINT: [ "/exporter"]
---
artifact: {{ .ModuleName }}/{{ .ImageName }}-artifact
from: {{ .Images.BASE_GOLANG_19_ALPINE }}
git:
- add: /{{ .ModulePath }}modules/030-{{ .ModuleName }}/images/{{ .ImageName }}
  to: /src
  excludePaths:
    - "**/*.md"
    - "**/*.yaml"
    - hack
  stageDependencies:
    install:
      - go.mod
      - go.sum
    setup:
      - go.mod
      - go.sum
      - "**/*.go"
mount:
- fromPath: ~/go-pkg-cache
  to: /go/pkg
shell:
  beforeInstall:
  - |
    apk upgrade --available --no-cache && \
    apk add --no-cache ca-certificates git make
  install:
  - cd /src
  - go mod download
  setup:
  - export GO_VERSION=${GOLANG_VERSION}
  - export GOPROXY={{ $.GOPROXY }}
  - cd /src
  - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o exporter .
  - chown 64535:64535 /src/exporter
  - chmod 0755 /src/exporter